package com.wang.madness.pojo;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import java.io.Serializable;
import java.time.LocalDateTime;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 用户(User)表实体类
 *
 * @author wangwenjun
 * @since 2021-04-29 16:40:31
 */
@TableName(value = "user")
@EqualsAndHashCode(callSuper = true)
@Data
public class User extends Model<User> {

  /**
   * 主键
   */
  @TableId(value = "id", type = IdType.ASSIGN_ID)
  private Long userId;
  /**
   * 用户名(用来登录)
   */
  @NotBlank(message = "用户名不能为空")
  @TableField(value = "user_name")
  private String userName;
  /**
   * 密码
   */
  @NotBlank(message = "密码不能为空")
  @TableField(value = "pass_word")
  private String passWord;
  /**
   * 邮箱(可以用来登录)
   */
  @NotBlank(message = "邮箱不能为空")
  @Email(message = "邮箱格式不正确")
  @TableField(value = "user_email")
  private String email;
  /**
   * 手机号(可以用来登录)
   */
  @NotBlank(message = "手机号不能为空")
  @TableField(value = "user_cell_phone")
  private String phone;
  /**
   * 登录名(系统显示的用户昵称)
   */
  @TableField(value = "user_login_name")
  private String name;
  /**
   * 创建时间
   */
  @TableField(value = "create_time", fill = FieldFill.INSERT)
  private LocalDateTime createTime;
  /**
   * 更新时间
   */
  @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
  private LocalDateTime updateTime;
  /**
   * 用户性别
   */
  @TableField(value = "user_sex")
  private String userSex;
  /**
   * 用户头像(url)
   */
  @TableField(value = "user_avatar")
  private String avatar;

  /**
   * 逻辑删除标志
   */
  private Integer deleted;

  /**
   * 获取主键值
   *
   * @return 主键值
   */
  @Override
  protected Serializable pkVal() {
    return this.userId;
  }
}
